import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);
const store = new Vuex.Store({
    modules: {}
});

//数据store去中心化
const storeContext = require.context('./modules/', true, /\.js$/)
storeContext.keys().map(function(key){
	let name = key.replace(/(^\.\/)|(\.js$)/g, '');
	//console.log(name,key,storeContext(key).default);
    store.registerModule(name, storeContext(key).default);
});

export default store;
